﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Mvc.Filters;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace NetCore
{
    /// <summary>
    /// 页面描述
    /// </summary>
    [System.AttributeUsage(AttributeTargets.Class)]
    public class MenuPageAttribute : Attribute
    {
        /// <summary>
        /// 前缀
        /// </summary>
        public const string PAGEPREFIX = "P";
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="orderNum">排序</param>
        /// <param name="pageid">页面id</param>
        /// <param name="localName">名称</param>
        /// <param name="routeUrl">路由</param>
        /// <param name="icon">图标</param>
        /// <param name="isDispay">是否显示</param>
        /// <param name="ismenu">是否菜单</param>
        public MenuPageAttribute(int orderNum,string pageid, string localName, string routeUrl, string icon, bool isDispay = true, bool ismenu = true)
        {
            PageId =pageid.PadLeft(4,'0');
            LocalName = localName;
            Icon = icon;
            IsMenu = ismenu;
            IsDispay = isDispay;
            RouteUrl = routeUrl;
            OrderNum = orderNum;
        }
        /// <summary>
        /// 页面Key
        /// </summary>
        public string PageId { get; set; }

        /// <summary>
        /// 本地名称
        /// </summary>
        public string LocalName { get; set; }

        /// <summary>
        /// 菜单名称
        /// </summary>
        public string MenuName { get; set; }
        /// <summary>
        /// 是否是菜单
        /// </summary>
        public bool IsMenu = true;

        /// <summary>
        /// 是否系统菜单
        /// </summary>
        public bool IsAdmin = true;

        /// <summary>
        /// 是否显示
        /// </summary>
        public bool IsDispay = true;

        /// <summary>
        /// 是否无效菜单
        /// </summary>
        public bool IsDeleted = false;

        public string RouteUrl { get; set; }
        /// <summary>
        /// 图标
        /// </summary>
        public string Icon { get; set; }
        /// <summary>
        /// 上级菜单
        /// </summary>
        public string ParentId { get; set; }

        public string ParentName { get; set; }

        public int OrderNum { get; set; }

        /// <summary>
        /// 是否是api接口
        /// </summary>
        public bool IsApi { get; set; }

        /// <summary>
        /// 页面功能列表
        /// </summary>
        public List<BasePermissionAttribute> PageActions{get;set;}
        //public PermissionAttribute()
        //{
        //    IsGet = true;
        //    IsPost = true;
        //}

    }
}
